const router = require('koa-router')()

router.get('/', async (ctx, next) => {

   //ctx.body="首页"
    let list={
        name:'张三',
        h:'<h2>这是一个h2</h2>',
        num:20,
        data:['11111111','2222222222','33333333333']
    }
    await ctx.render('www/index',{
        list:list
    });

})

router.get('/string', async (ctx, next) => 
{
  ctx.body = 'koa2 string'
})


router.get('/json', async (ctx, next) => {
  ctx.body = {
    title: 'koa2 json',
    // cookie:ctx.cookies.get('pvid')
  }
})

module.exports = router
